<!doctype html>
<html>
  <head>
    <title>Debug Tables API</title>
  </head>
  <body>
    <h1>调试数据表API</h1>
    <button onclick="testTablesAPI()">测试表列表API</button>
    <button onclick="testTableDetail(1)">测试表详情API (ID=1)</button>
    <pre id="output"></pre>

    <script>
      async function testTablesAPI() {
        try {
          const response = await fetch("http://localhost:8999/api/database/imported/tables?current=1&size=100")
          const data = await response.json()
          document.getElementById("output").textContent = JSON.stringify(data, null, 2)
          console.log("Tables API Response:", data)
        } catch (error) {
          document.getElementById("output").textContent = "Error: " + error.message
          console.error("Error:", error)
        }
      }

      async function testTableDetail(tableId) {
        try {
          const response = await fetch(`http://localhost:8999/api/database/table/${tableId}`)
          const data = await response.json()
          document.getElementById("output").textContent = JSON.stringify(data, null, 2)
          console.log("Table Detail API Response:", data)
        } catch (error) {
          document.getElementById("output").textContent = "Error: " + error.message
          console.error("Error:", error)
        }
      }
    </script>
  </body>
</html>
